package com.hfzy.ihk.web.userCenter.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hfzy.ihk.facade.userCenter.entity.Priv;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用于集成spring security,权限表 Mapper 接口
 * </p>
 *
 * @author wws
 * @since 2018-12-28
 */
public interface PrivMapper extends BaseMapper<Priv> {

    int count(@Param("params") Map<String, Object> params);

    List<Priv> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
                    @Param("limit") Integer limit);


    @Select("select * from priv t where t.priv_name = #{name}")
    Priv getPriv(String name);

    @Select("select p.* from priv p inner join user_has_priv uhp on uhp.priv_id = p.id where uhp.user_id = #{uid}")
    List<Priv> getPrivByUserId(int uid);

}
